package io低级流or节点流;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class CopyDemo02 {
    public static void main(String[] args) throws IOException {

        FileInputStream fil = new FileInputStream("风景图.jpg");
        FileOutputStream fol = new FileOutputStream("风景图2.jpg");


        byte[] by = new byte[1024 * 10];
        int b;//记录实际字节
        while ((b=fil.read(by))!=-1){
            fol.write(by,0,b);//将字节数组从下标为0开始到b个字节写出(实现读多少就写多少字节)

        }


        fil.close();
        fol.close();








        /*
        long l = System.currentTimeMillis();
        byte[] by = new byte[1024 * 10];
        while (fil.read(by)!=-1){
            fol.write(by);

        }
        long l1 = System.currentTimeMillis();
        System.out.println(l1-l);

        fil.close();
        fol.close();
        */

    }


}
